function h = gabortest(I, a, nb, ntheta, lambda, psi, gamma)
    if nargin < 7
        gamma = 0.5;% gamma=1 circular?
    end
    if nargin < 6
        psi = 0;
    end
    if nargin < 5
        lambda = 8;
    end
    if nargin < 4
        ntheta = 6;
    end
    if nargin < 3
        nb = 4;
    end
    if nargin < 2
        a = 2
    end
    h = cell(nb, ntheta);
    for b0 = 1:nb
        b = a^(1-b0);
        for i = 1:ntheta
            theta = i/ntheta*pi;
            h{i}{b0} = gabor_singletest(I, b, theta,lambda,psi,gamma);
            %imshow(h{i}{b0}, []);
            %pause(0.1);
        end
    end    
end

function h=gabor_singletest(img, b, theta, lambda, psi ,gamma)
    sigma = 1/pi*((log(2)/2)^0.5)*(2^b+1)/(2^b-1)*lambda;
    g = gabor_fn(sigma, theta, lambda, psi, gamma);
    h = conv2(double(img), g, 'same');
end